<?php

namespace Logic;

use Config\redis;

class RedisClientLogic
{
    private static $instance = null;


    /**
     * Get a instance of MyRedisClient
     *
     * @param string $key
     * @return object
     */
    public static function getInstance()
    {
        if (!self::$instance) {
            //todo
            $redis = new \Redis();
            $db = redis::redis();
            $redis->connect($db['dbHost'], $db['port']);
//            $redis->auth('23');
            self::$instance = $redis;
        }
        return self::$instance;
    }


    // 构造器私有化:禁止从类外部实例化
    private function __construct()
    {
    }

    // 克隆方法私有化:禁止从外部克隆对象
    private function __clone()
    {
    }


}

